<template>
  <!-- 历史记录页面 -->
  <div>
    <!-- 头部 -->
    <Title></Title>
    <!-- 内容 -->
    <div class="conten">
      <van-cell
        v-for="item in list"
        :key="item.articleId"
        :title="item.title"
        :to="{name:'details',params:{articleId:item.articleId}}"
      ></van-cell>
    </div>
    <!-- 底部 -->
    <Botto></Botto>
  </div>
</template>
<script>
import Title from "../components/Title.vue";
import Botto from "../components/Bottom.vue";
import { getNewsDetails } from "../api/CMS-api";
export default {
  created() {
    this.history = JSON.parse(localStorage.getItem("Article_history") || "[]");
    this.history.forEach(element => {
      getNewsDetails(element).then(res => {
        this.list.push(res.data);
      });
    });
  },
  data() {
    return {
      history: [],
      list: []
    };
  },
  components: {
    Title,
    Botto
  }
};
</script>
<style lang="less" scoped>
</style>